<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登录</title>
<link rel="stylesheet" type="text/css" href="<%=path %>/manage/css/public.css" />
<link rel="stylesheet" type="text/css" href="<%=path %>/manage/css/page.css" />
<script type="text/javascript" src="<%=path %>/manage/js/jquery.min.js"></script>
<script type="text/javascript" src="<%=path %>/manage/js/public.js"></script>
</head>
<body>
	<!-- 登录body -->
	<form id="myform" action="<%=path %>/AdminServlet?action=login" method="post">
	<div class="logDiv">
		<img class="logBanner" src="<%=path %>/manage/images/logBanner.png" />
		<div class="logGet">
			<!-- 头部提示信息 -->
			<div class="logD logDtip">
				<p class="p1">登录</p>
			</div>
			<!-- 输入框 -->
			<div class="lgD">
				<img class="img1" src="<%=path %>/manage/images/logName.png" /><input type="text" name="admin"
					placeholder="输入用户名" />
			</div>
			<div class="lgD">
				<img class="img1" src="<%=path %>/manage/images/logPwd.png" /><input type="password" name="password"
					placeholder="输入用户密码" />
			</div>
			<div class="lgD">
				<img class="img2" style="width:50;height:25" src="<%=request.getContextPath()%>/CodeServlet?action=code" /><input class="co" type="password" name="password"
					placeholder="输入验证码" />
			</div>
			<div class="logC">
				<input type="button" value="登录" id="login"/>
			</div>
		</div>
	</div>
	</form>
	<!-- 登录body  end -->

	<!-- 登录页面底部 -->
	<div class="logFoot">
		<p class="p1">版权所有：南瓜美食</p>
	</div>
	<!-- 登录页面底部end -->
</body>
</html>
<script src="<%=path%>/manage/js/jquery.min.js"></script>
<script>

$(function(){
	$("#login").click(function(){
		var code=$(".co").val();
		$.ajax({
			url:"<%=request.getContextPath()%>/CodeServlet?action=checkCode",
			data:{code:code},
			success:function(data){
				if("ok"==data){
					$("#myform").submit();
				}
			}
		})
	})
	
	//点击切换验证码
	$(".img2").click(function(){
		$(this).attr("src","<%=request.getContextPath()%>/CodeServlet?action=code&rand="+Math.random());
	});	
});
</script>